package com.markyao.controller.recos;

import com.markyao.recos.get.RecosGetService;
import com.markyao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

@RestController
@RequestMapping("/recos/get")
public class RecosGetController {

    @Autowired
    RecosGetService recosGetService;

    @GetMapping("getAppname")
    public Result getAppname(@RequestParam("url") String url) {
        return recosGetService.getAppName(url);
    }

    @GetMapping("getWeight")
    public Result getWeight(@RequestParam("appName") String appName) {
        return recosGetService.getWeight(appName);
    }

    @GetMapping("getProviderCount")
    public Result getProviderCount(@RequestParam("interfaceNAME") String interfaceNAME) {
        return recosGetService.getProviderCount(interfaceNAME);
    }

    @GetMapping("getUrlForWeights")
    public Result getUrlForWeights(@RequestParam("interfaceNAME") String interfaceNAME) {
        return recosGetService.getUrlForWeights(interfaceNAME);
    }

    @GetMapping("getProviderUrlStrByIntefaceName")
    public Result getProviderUrlStrByIntefaceName(@RequestParam("interfaceName") String interfaceName) {
        return recosGetService.getProviderUrlStrByIntefaceName(interfaceName);
    }

    @GetMapping("getInitConnects")
    public Result getInitConnects(@RequestParam("appName") String appName){
        return recosGetService.getInitConnects(appName);
    }
    @GetMapping("hasKey")
    public Result hasKey(@RequestParam("key") String k) {
        return recosGetService.hasKey(k);
    }


    @GetMapping("getUrlStrSeleceds")
    public Result getUrlStrSeleceds(@RequestParam("interfaceNAME") String interfaceNAME) {
        return recosGetService.getUrlStrSeleceds(interfaceNAME);
    }

    @GetMapping("getUrlStrByIdx")
    public Result getUrlStrByIdx(@RequestParam("interfaceNAME") String interfaceNAME, @RequestParam("idx") Integer idx) {
        return null;
    }

    @GetMapping("getServiceClass")
    public Result getServiceClass(@RequestParam("appName") String appName
            , @RequestParam("interfaceNAME") String interfaceNAME) {
        return null;
    }

    @GetMapping("getRefrences")
    public Result getRefrences(@RequestParam("appName") String appName) {
        return null;
    }

    @GetMapping("getUrlSize")
    public long getUrlSize(@RequestParam("interfaceName") String interfaceName) {
        return 0;
    }

    @GetMapping("getUrlByAppName")
    public Result getUrlByAppName(@RequestParam("appName")String appName){
        return recosGetService.getUrlByAppName(appName);
    }
}
